﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KagSharp.Expressions
{
    public class LabelExpression : IExpression
    {
    	private string _Name;
    	public string Name { get{return _Name;}set{_Name = value;} }
    	private string _Description;
    	public string Description { get{return _Description;}set{_Description = value;} }

        public LabelExpression(string name, string description)
        {
            Name = name;
            Description = description;
        }

        public void Print(StringBuilder sb, bool verbose, int indentLevel)
        {
            ExpressionHelper.Indent(sb, GetType(), indentLevel);
            sb.Append('*').Append(Name);
            if (!String.IsNullOrEmpty(Description) && Name != Description)
                sb.Append('|').Append(Description);
        }

        public TR Accept<TR>(IExpressionVisitor<TR> visitor, string context) {return visitor.Visit(this, context);}

        public Type ValueType {get{return typeof(LabelExpression);}}

        public override string ToString() {return "LabelExpression: " + Name;}
    }
}
